package com.alax.interfaces.service.impl;

import java.util.List;
import com.alax.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alax.interfaces.mapper.ApiCategoryMapper;
import com.alax.interfaces.domain.ApiCategory;
import com.alax.interfaces.service.IApiCategoryService;

/**
 * API分类Service业务层处理
 * 
 * @author alax
 * @date 2025-04-03
 */
@Service
public class ApiCategoryServiceImpl implements IApiCategoryService 
{
    @Autowired
    private ApiCategoryMapper apiCategoryMapper;

    /**
     * 查询API分类
     * 
     * @param id API分类主键
     * @return API分类
     */
    @Override
    public ApiCategory selectApiCategoryById(Long id)
    {
        return apiCategoryMapper.selectApiCategoryById(id);
    }

    /**
     * 查询API分类列表
     * 
     * @param apiCategory API分类
     * @return API分类
     */
    @Override
    public List<ApiCategory> selectApiCategoryList(ApiCategory apiCategory)
    {
        return apiCategoryMapper.selectApiCategoryList(apiCategory);
    }

    /**
     * 新增API分类
     * 
     * @param apiCategory API分类
     * @return 结果
     */
    @Override
    public int insertApiCategory(ApiCategory apiCategory)
    {
        apiCategory.setCreateTime(DateUtils.getNowDate());
        return apiCategoryMapper.insertApiCategory(apiCategory);
    }

    /**
     * 修改API分类
     * 
     * @param apiCategory API分类
     * @return 结果
     */
    @Override
    public int updateApiCategory(ApiCategory apiCategory)
    {
        apiCategory.setUpdateTime(DateUtils.getNowDate());
        return apiCategoryMapper.updateApiCategory(apiCategory);
    }

    /**
     * 批量删除API分类
     * 
     * @param ids 需要删除的API分类主键
     * @return 结果
     */
    @Override
    public int deleteApiCategoryByIds(Long[] ids)
    {
        return apiCategoryMapper.deleteApiCategoryByIds(ids);
    }

    /**
     * 删除API分类信息
     * 
     * @param id API分类主键
     * @return 结果
     */
    @Override
    public int deleteApiCategoryById(Long id)
    {
        return apiCategoryMapper.deleteApiCategoryById(id);
    }
}
